package com.company.recursion;

/**
 * @author shenhan
 * @create 2020/1/29 14:52
 * @description
 */
public class RecursionTest {
    public static void main(String[] args) {
        System.out.println(factorial(10));
    }


    public static void test(int n) {
        if (n > 2) {
            test((n - 1));
        }
        System.out.println("n = " + n);
    }

    public static int factorial(int n) {
        if (n == 1) {
            return 1;
        } else {
            return factorial(n - 1) * n;
        }
    }
}
